Skip to content

Kotlin: support 2.4.20-RC - #22404

Draft
andersfugmann wants to merge 2 commits into
mainfrom
andersfugmann/kotlin-2.4.20rc
Draft

Kotlin: support 2.4.20-RC#22404
andersfugmann wants to merge 2 commits into
mainfrom
andersfugmann/kotlin-2.4.20rc

Conversation

@andersfugmann

@andersfugmann andersfugmann commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Support Kotlin 2.4.20-RC in the Kotlin extractor. Kotlin 2.4.20 GA remains unsupported.

The implementation is split between release-driven compatibility changes and two observed RC behaviours. The release changelog explicitly removes remaining ComponentRegistrar usage (KT-85816) and applies @K1Deprecation to public K1 APIs (KT-86046). The RC compiler also gives generated interface forwarders synthetic source offsets and rejects the previous repeatable-annotation access path. The extractor adapts to those behaviours without changing query results.

Parent PR: github/semmle-code#56185

Motivation for each change

Change Motivation
Add standalone, embeddable, and standard-library RC artefacts Build and test the extractor against the published v2.4.20-RC compiler rather than an inferred compatible version.
Add an RC-specific CompilerPluginRegistrar implementation ComponentRegistrar is absent from the RC compiler, matching KT-85816. The existing registrar cannot be loaded because it implements both APIs.
Package the legacy ComponentRegistrar service only before 2.4.20 Older compilers still require the legacy service, while the RC fails if that service refers to the removed class. This keeps compatibility selection at the build boundary.
Opt in to org.jetbrains.kotlin.K1Deprecation from 2.4.20 The extractor still uses K1 compatibility APIs. KT-86046 makes the opt-in an error-level requirement in the RC.
Reuse the annotationClass compatibility extension The RC rejects the previous IR parent access. The existing extension uses constructedClass and also compiles with the oldest supported Kotlin 1.8.0 compiler.
Assign fabricated interface forwarders the enclosing class location The RC reports synthetic offsets for these generated declarations. They have no direct source declaration, so the enclosing class is the stable location and preserves previous database and query output. This behaviour was observed during extraction and is not called out explicitly in the release changelog.
Make 2.4.20-RC the development and Kotlin 2 test default Exercise the newly supported compiler in the normal Kotlin 2 suite.
Test 2.4.20 GA in the too-new diagnostic Verify the intended RC-only boundary directly.
Update documentation and the change note to 2.4.20-RC Avoid implying support for 2.4.20 GA.

Compatibility

  • Compiler variants before 2.4.20 retain their existing registrar and service packaging.
  • The K1 opt-in changes compilation only and does not change extracted data.
  • Repeatable annotation extraction uses the existing cross-version compatibility path.
  • Generated forwarders retain their previous observable locations. No fake-override, AST, expression-type, or inherited-interface-default expectations change.
  • Kotlin 2.4.20 GA and other prerelease spellings remain unsupported.

Validation

  • Built standalone and embeddable 2.4.20-RC extractor variants
  • Built the oldest supported 1.8.0 extractor variant
  • Full Kotlin 2 suite passed in eight sequential shards with one test thread
  • Full Kotlin 1 suite passed with 2.3.20 in eight sequential shards with one test thread
  • All 36 Kotlin all-platform extraction tests passed in eight sequential shards
  • All 63 Kotlin all-platform QL integration tests passed in eight sequential shards
  • The published v2.4.20-RC compiler passed the Kotlin basic functionality extraction test
  • The too-new diagnostic test rejects 2.4.20 GA

No tests are disabled. The only changed generated expectation is the too-new diagnostic.

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch 3 times, most recently from a205abc to e280a20 Compare August 24, 2026 13:46
andersfugmann and others added 2 commits August 24, 2026 16:17
Add standalone and embeddable extractor variants for the published RC.

Adapt plugin registration to two Kotlin 2.4.20 Beta2 changes:
- KT-85816 removes the remaining ComponentRegistrar usage.
- KT-86046 applies K1Deprecation to public K1 APIs.

Use CompilerPluginRegistrar without loading the removed legacy API for the
RC, while retaining the legacy path for older compilers. Opt in to the K1
compatibility APIs that the extractor still requires.

The RC also gives generated interface forwarders synthetic source offsets.
Use their enclosing class location to preserve previous database and query
behaviour. Keep Kotlin 2.4.20 GA above the supported-version boundary.

Kotlin changelog:
https://github.com/JetBrains/kotlin/blob/v2.4.20-RC/ChangeLog.md#2420-beta2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the published RC by default in the development wrapper so the Kotlin 2
suite exercises the compiler compatibility changes from KT-85816 and
KT-86046.

Use Kotlin 2.4.20 GA in the too-new diagnostic fixture to verify that support
remains limited to the RC.

Kotlin changelog:
https://github.com/JetBrains/kotlin/blob/v2.4.20-RC/ChangeLog.md#2420-beta2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch from e280a20 to a0fb883 Compare August 24, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant